﻿//-----------------------------------------------------------------------------------------------------------
// Wbfs Engine (WBFSe) Project by Omega Frost 
// http://wbfse.codeplex.com/
//
// WBFSe is Licensed under the terms of the 
// Microsoft Reciprocal License (Ms-RL)
//-----------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WBFSe.Data
{
    /// <summary>
    /// Game entry in a Wbfs partition
    /// </summary>
    class FileSystemEntry : IComparer<FileSystemEntry>
    {
        // Variables

        private int discIndex;
        private string code;
        private string name;

        // Properties

        /// <summary>
        /// The index of the disc in the FS table
        /// </summary>
        public int DiscIndex
        {
            get { return this.discIndex; }
        }

        /// <summary>
        /// The code of the disc's game
        /// </summary>
        public String Code
        {
            get { return this.code; }
        }

        /// <summary>
        /// The name of the disc's game
        /// </summary>
        public String Name
        {
            get { return this.name; }
        }
        
        // Methods

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="index">The index of the disc in the FS table</param>
        /// <param name="name">The name of the disc's game</param>
        /// <param name="code">The code of the disc's game</param>
        public FileSystemEntry(int index, string name, string code)
        {
            this.discIndex = index;
            this.name = name;
            this.code = code;
        }

        /// <summary>
        /// ToString
        /// </summary>
        /// <returns>String</returns>
        public override string ToString()
        {
            return String.Format("{0} {1}",
                this.code, this.name);
        }

        /// <summary>
        /// Compares 2 entries
        /// </summary>
        /// <param name="x">Entry 1</param>
        /// <param name="x">Entry 2</param>
        /// <returns>Comparison</returns>
        public int Compare(FileSystemEntry x, FileSystemEntry y)
        {
            return x.ToString().CompareTo(y.ToString());
        }
    }
}
